<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Event</title>
<script src="../src/js/YAHOO.js" type="text/javascript"></script>
<style type="text/css">
    #linkContainer {
        position: relative;
        padding: 10px;
        border: 1px solid #333333;
        height: 300px;
        width: 150px;
    }
</style>
<script type="text/javascript">

(function() {
    // undeclared variables are globally scoped, so this is accessible 
    // everywhere, and also would overwrite an existing global YAHOO.
    YAHOO = {};
    YAHOO.a = "global a";
    YAHOO.b = "global b";
})();

(function() {
    // local scope, can only be accessed inside of the anonymous 
    // function.  If a global YAHOO exists, it will survive.  References
    // to YAHOO here will refer to the locally scoped YAHOO, while
    // references outside will refer to the original global.
    var YAHOO = {}; 
    YAHOO.a = "local a";
    YAHOO.b = "local b";

    alert(YAHOO.a);
    alert(YAHOO.b);
})();

alert(YAHOO.a);
alert(YAHOO.b);

</script>
<body>

<a href="javascript:;">Does nothing</a>
<div id="linkContainer">
  <h3>Header does nothing</h3>
</div>
<input id="addButton" type="button" value="Add link" />
</body>

</html>

